import 'package:xr_base/common.dart';

List<BannerMo> getBanners(List<dynamic> list) {
  List<BannerMo> result = [];
  list.forEach((item) {
    result.add(BannerMo.fromJson(item));
  });
  return result;
}

class BannerMo {
  String? createId;
  String? createBy;
  String? createTime;
  String? updateBy;
  String? updateTime;
  String? params;
  int? advertId;
  String? imgUrl;
  String? webUrl;

  BannerMo(
      {this.createId,
      this.createBy,
      this.createTime,
      this.updateBy,
      this.updateTime,
      this.params,
      this.advertId,
      this.imgUrl,
      this.webUrl});

  BannerMo.fromJson(Map<String, dynamic> json) {
    createId = json['createId'];
    createBy = json['createBy'];
    createTime = json['createTime'];
    updateBy = json['updateBy'];
    updateTime = json['updateTime'];
    params = json['params'];
    advertId = json['advertId'];
    imgUrl = json['imgUrl'];
    webUrl = json['webUrl'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['createId'] = this.createId;
    data['createBy'] = this.createBy;
    data['createTime'] = this.createTime;
    data['updateBy'] = this.updateBy;
    data['updateTime'] = this.updateTime;
    data['params'] = this.params;
    data['advertId'] = this.advertId;
    data['imgUrl'] = this.imgUrl;
    data['webUrl'] = this.webUrl;
    return data;
  }

  get tempImageUrl => Constant.qiniu_address + '/' + '${imgUrl ?? ''}';
}
